# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=xapian-bindings-php7
pkgver=1.4.19
pkgrel=0
pkgdesc="Binding PHP7 libraries for xapian"
url="http://www.xapian.org"
arch="all"
license="GPL-2.0-or-later"
makedepends="automake autoconf libtool bash xapian-core-dev sphinx php7-dev"
subpackages="$pkgname-doc"
source="http://www.oligarchy.co.uk/xapian/$pkgver/xapian-bindings-$pkgver.tar.xz
	remove-test-x86.patch"

builddir="$srcdir/${pkgname/-php7/}-$pkgver"

prepare() {
	default_prepare
	aclocal && autoconf
	libtoolize
	autoreconf -fvi
}

check() {
	make VALGRIND= -C "$builddir" check
}

build() {
	export PHP7=/usr/bin/php7
	export PHP_CONFIG7=/usr/bin/php-config7
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-php7 \
		--without-perl \
		--without-lua \
		--without-python3 \
		--without-ruby \
		--without-tcl \
		XAPIAN_CONFIG=/usr/bin/xapian-config
	make
}

package() {
	make DESTDIR=$pkgdir install
	install -d "$pkgdir"/usr/share/php7 \
		"$pkgdir"/usr/lib/php7/modules \
		"$pkgdir"/etc/php7/conf.d
	echo ';extension=xapian.so' > "$pkgdir/etc/php7/conf.d/xapian.ini"
}

sha512sums="
c3e353a192822be5d86d448b9d5e4c5eb15d5eb2d079560f7c457f8f7ca85d42e2b933891e784d384c188577f427ca1929c2b47732b9d637e36543e8b5b704d6  xapian-bindings-1.4.19.tar.xz
340e965894c2689eb94b3e1d4553aaec436291f5fb638f20b14ef8b37293570d1ed7637645e974f26605f7ec3705c2eac0a23c97708902939e3b743f82ffbac9  remove-test-x86.patch
"
